# -*- encoding=utf8 -*-

__author__ = "yiershan"

from airtest.core.api import *
import random
auto_setup(__file__)

hb = 1

def _ks():
    ks = exists(Template(r"tpl1573088743339.png", record_pos=(-0.38, -0.28), resolution=(540, 960)))

    if ks:
        touch(ks)
        h = False
        while not h:
            sleep(2)
            h = exists(Template(r"tpl1571161877314.png", record_pos=(-0.372, -0.122), resolution=(540, 960)))
            if not h:
                _ks()
        
k = True
while k:
    qsn = exists(Template(r"tpl1571161829632.png", record_pos=(-0.006, 0.417), resolution=(540, 960)))
    if qsn:
        touch(qsn)
    yq = exists(Template(r"tpl1573693850953.png", record_pos=(-0.367, -0.515), resolution=(540, 960)))
    if yq:
        touch(yq)
    sj = exists(Template(r"tpl1573710036448.png", record_pos=(0.006, 0.028), resolution=(540, 960)))
    if sj:
        touch(Template(r"tpl1573710095860.png", record_pos=(0.306, 0.143), resolution=(540, 960)))

    _ks()
    # k = exists(Template(r"tpl1571161877314.png", record_pos=(-0.372, -0.122), resolution=(540, 960))) or exists(Template(r"tpl1573611785246.png", record_pos=(0.031, -0.733), resolution=(540, 960)))

    sleep(random.randint(3,9))
    swipe(v1=(300,600),v2=(300,300),duration=0.1)


